using System;
using System.Collections.Generic;


namespace LiveCS.Models
{
	[Serializable]
	public class Consumemoney: IEquatable<Consumemoney>
	{

		#region Private Members

		private Member _cardid; 
		private DateTime _operationtime; 
		private decimal _consumemoney; 
		private decimal _rechargemoney; 
		private User _userid; 
		private string _remark; 		
		#endregion

		#region Constructor

		public Consumemoney()
		{
			_cardid = new Member(); 
			_operationtime = DateTime.MinValue; 
			_consumemoney = 0; 
			_rechargemoney = 0; 
			_userid = new User(); 
			_remark = String.Empty; 
		}
		#endregion // End of Default ( Empty ) Class Constuctor

		#region Public Properties
			
		public virtual Member Cardid
		{
			get
			{ 
				return _cardid;
			}
			set
			{
				_cardid = value;
			}

		}
			
		public virtual DateTime OperationTime
		{
			get
			{ 
				return _operationtime;
			}
			set
			{
				_operationtime = value;
			}

		}
			
		public virtual decimal ConsumeMoney
		{
			get
			{ 
				return _consumemoney;
			}
			set
			{
				_consumemoney = value;
			}

		}
			
		public virtual decimal RechargeMoney
		{
			get
			{ 
				return _rechargemoney;
			}
			set
			{
				_rechargemoney = value;
			}

		}
			
		public virtual User Userid
		{
			get
			{ 
				return _userid;
			}
			set
			{
				_userid = value;
			}

		}
			
		public virtual string Remark
		{
			get
			{ 
				return _remark;
			}

			set	
			{	
				if(  value != null &&  value.Length > 100)
					throw new ArgumentOutOfRangeException("Invalid value for Remark", value, value.ToString());
				
				_remark = value;
			}
		}
			
				
		#endregion 

		#region Public Functions

		#endregion //Public Functions

		#region Equals And HashCode Overrides
		/// <summary>
		/// local implementation of Equals based on unique value members
		/// </summary>
		public override bool Equals( object obj )
		{
			if( this == obj ) return true;
			if( ( obj == null ) || ( obj.GetType() != this.GetType() ) ) return false;
			Consumemoney castObj = (Consumemoney)obj; 
			return castObj.GetHashCode() == this.GetHashCode();
		}
		
		/// <summary>
		/// local implementation of GetHashCode based on unique value members
		/// </summary>
		public override int GetHashCode()
		{
			return this.GetType().FullName.GetHashCode();
				
		}
		#endregion
		
		#region IEquatable members

		public bool Equals(Consumemoney other)
		{
			if (other == this)
				return true;
		
			return other.GetHashCode() == this.GetHashCode();
				   
		}

		#endregion
		
	}
}
